class Breedhead < ActiveRecord::Base
  def self.search(search, page)
      jefes = find_by_sql "SELECT b.`breed_name`, h.`horse_name`, h.`id` as horse_id FROM `breeds` b, horses h, breedheads bh WHERE (b.`breed_name` like '%#{search}%' and b.`id` = bh.`breed_id` and h.`id` = bh.`horse_id`)"
      jefes.paginate :per_page => 10, :page => page 
  end
end
